//
//  ScrollModel.m
//  CarHome
//
//  Created by 蒋寒霄 on 14-9-18.
//  Copyright (c) 2014年 WJN_work@163.com. All rights reserved.
//

#import "ScrollModel.h"

@implementation ScrollModel
- (void)dealloc
{
    [_focusimg release];
    _focusimg = nil;
    [_newslist release];
    _newslist = nil;
    [_shuoKeList release];
    _shuoKeList = nil;
    [_vediosList release];
    _vediosList = nil;
    [super dealloc];
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.focusimg = [[[NSMutableArray alloc] init] autorelease];
        self.newslist = [[NSMutableArray alloc] init];
        [_newslist release];
        self.shuoKeList = [NSMutableArray array];
        self.vediosList = [NSMutableArray array];
    }
    return self;
}
//首页滚动视图的数据封装
+ (ScrollModel *)returnModelArrayWithDic:(NSMutableDictionary *)scrollDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [scrollDic objectForKey:@"focusimg"]) {
        FoucusImageModel *focusImage = [[FoucusImageModel alloc] init];
        focusImage.image_ID = [dic objectForKey:@"id"];
        focusImage.image_smallPic = [dic objectForKey:@"imgurl"];
        focusImage.image_mediatype = [dic objectForKey:@"mediatype"];
        focusImage.image_index = 0;
        [model.focusimg addObject:focusImage];
        [focusImage release];
    }
    return [model autorelease];
}
//(最新,新闻,评测,行情,用车,文化,改装,游记,技术,导购)界面的数据类型封装
+ (ScrollModel *)returnModelArrayWithNewsList:(NSMutableDictionary *)resultDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [resultDic objectForKey:@"newslist"]) {
        FoucusImageModel *lastImage = [[FoucusImageModel alloc] init];
        lastImage.image_ID = [dic objectForKey:@"id"];
        lastImage.image_title = [dic objectForKey:@"title"];
        lastImage.image_type = [dic objectForKey:@"type"];
        lastImage.image_time = [dic objectForKey:@"time"];
        lastImage.image_indexDetail = [dic objectForKey:@"indexdetail"];
        lastImage.image_smallPic = [dic objectForKey:@"smallpic"];
        lastImage.image_lastTime = [dic objectForKey:@"lasttime"];
        lastImage.image_mediatype = [dic objectForKey:@"mediatype"];
        lastImage.image_index = 0;
        [model.newslist addObject:lastImage];
        [lastImage release];
    }
    return [model autorelease];
}

//说客界面的数据类型封装
+ (ScrollModel *)returnArrayWithPersuader:(NSMutableDictionary *)resultDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [resultDic objectForKey:@"list"]) {
        FoucusImageModel *lastImage = [[FoucusImageModel alloc] init];
        lastImage.image_ID = [dic objectForKey:@"id"];
        lastImage.image_title = [dic objectForKey:@"title"];
        lastImage.image_type = [dic objectForKey:@"type"];
        lastImage.image_time = [dic objectForKey:@"time"];
        lastImage.image_indexDetail = [dic objectForKey:@"indexdetail"];
        lastImage.image_smallPic = [dic objectForKey:@"smallpic"];
        lastImage.image_index = 0;
        [model.shuoKeList addObject:lastImage];
        [lastImage release];
    }
    return [model autorelease];
}
//视频界面的数据类型封装
+ (ScrollModel *)returnArrayWithMovie:(NSMutableDictionary *)resultDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [resultDic objectForKey:@"list"]) {
        FoucusImageModel *lastImage = [[FoucusImageModel alloc] init];
        lastImage.image_ID = [dic objectForKey:@"id"];
        lastImage.image_title = [dic objectForKey:@"title"];
        lastImage.image_type = [dic objectForKey:@"type"];
        lastImage.image_time = [dic objectForKey:@"time"];
        lastImage.image_indexDetail = [dic objectForKey:@"indexdetail"];
        lastImage.image_smallPic = [dic objectForKey:@"smallimg"];
        lastImage.image_index = 0;
        [model.vediosList addObject:lastImage];
        [lastImage release];
    }
    return [model autorelease];
}
//推广列表
+ (ScrollModel *)returnArrayWithGeneralizeAD:(NSMutableDictionary *)resultDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [resultDic objectForKey:@"adlist"]) {
        FoucusImageModel *lastImage = [[FoucusImageModel alloc] init];
        lastImage.image_ID = [dic objectForKey:@"id"];
        lastImage.image_title = [dic objectForKey:@"title"];
        lastImage.image_time = [dic objectForKey:@"pubtime"];
        lastImage.image_smallPic = [dic objectForKey:@"imgpath"];
        lastImage.image_urlPath = [dic objectForKey:@"url"];
        lastImage.image_index = [[dic objectForKey:@"posindex"] integerValue];
        [model.newslist addObject:lastImage];
        [lastImage release];
    }
    return [model autorelease];
}
//推广焦点图
+ (ScrollModel *)returnArrayWithGeneralizeFocus:(NSMutableDictionary *)resultDic
{
    ScrollModel *model = [[ScrollModel alloc] init];
    for (NSDictionary *dic in [resultDic objectForKey:@"focusimglist"]) {
        FoucusImageModel *lastImage = [[FoucusImageModel alloc] init];
        lastImage.image_ID = [dic objectForKey:@"id"];
        lastImage.image_title = [dic objectForKey:@"title"];
        lastImage.image_smallPic = [dic objectForKey:@"imgpath"];
        lastImage.image_urlPath = [dic objectForKey:@"url"];
        lastImage.image_index = [[dic objectForKey:@"posindex"] integerValue];
        lastImage.image_mediatype = [dic objectForKey:@"mediatype"];
        [model.focusimg addObject:lastImage];
        [lastImage release];
    }
    return [model autorelease];
}

@end
